<?php

/**
 *
 * @author Níssius Ribas <nissius@wtprime.com.br>
 */

class m_faq extends NT_Manager_Controller {

    private $crud, $tabela;

    public function __construct() {
        parent::__construct();
               
        $this->checkLogin();
        $this->load->library('grocery_CRUD');
        $this->crud = new grocery_CRUD();  

        if (!$this->nt_manager_permissoes->isValid($this->uri->segment_array() + array("add")))
            $this->crud->unset_add();

        if (!$this->nt_manager_permissoes->isValid($this->uri->segment_array() + array("edit")))
            $this->crud->unset_edit();

        if (!$this->nt_manager_permissoes->isValid($this->uri->segment_array() + array("delete")))
            $this->crud->unset_delete();
        
        if (!$this->nt_manager_permissoes->isValid($this->uri->segment_array() + array("print")))
            $this->crud->unset_print();
        
        if (!$this->nt_manager_permissoes->isValid($this->uri->segment_array() + array("export")))
            $this->crud->unset_export();
        
    }
    
    public function index() { 
        $this->tabela = 'nt_faq';
        $this->load->model($this->tabela);
        $this->crud ->set_rules($this->{$this->tabela}->getRules())
                    ->auto_label($this->{$this->tabela}->getRules())
                    ->set_table($this->tabela)
                    ->set_subject("Perguntas Frequentes")
                    ->columns('PERGUNTA')
                    ->unset_texteditor('RESPOSTA');
        
        $crud = $this->crud->render();

        $data['crud'] = $crud;
        $this->load->view("manager/m_default/index", $data);
    }
    
}